<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>plot2d_old_version</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : 16/12/2004</div>
    <p>
      <b>plot2d_old_version</b> - 2D plot reference</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>plot2d([x],y)</tt>
      </dd>
      <dd>
        <tt>plot2d([x],y,&lt;opt_args&gt;) (new
    syntax)</tt>
      </dd>
      <dd>
        <tt>plot2d([logflag],x,y,[style,strf,leg,rect,nax])
    (old syntax)</tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>x,y</b>
        </tt>: two matrices (or column vectors).<ul>
          <li>
            <tt>
              <b></b>
            </tt>in the usual way <tt>
              <b>x</b>
            </tt> is a matrix of the same
                size than <tt>
              <b>y</b>
            </tt> (the column j of <tt>
              <b>y</b>
            </tt> is
                plotted with respect to column j of <tt>
              <b>x</b>
            </tt>)</li>
          <li>
            <tt>
              <b></b>
            </tt>if all the columns of <tt>
              <b>x</b>
            </tt> are equal (ie the
                abscissae of all the curves are the same), <tt>
              <b>x</b>
            </tt> may
                be simply the (column) vector of these abscissae
                (<tt>
              <b>x</b>
            </tt> is then a column vector of length equal to the
                row dimension of <tt>
              <b>y</b>
            </tt>).</li>
          <li>
            <tt>
              <b></b>
            </tt>when <tt>
              <b>x</b>
            </tt> is not given, it is supposed to be the
                column vector [1; 2; ...; row dimension of y].</li>
        </ul>
      </li>
      <li>
        <tt>
          <b>&lt;opt_args&gt;</b>
        </tt>: This represents a sequence of statements <tt>
          <b>key1=value1, key2=value2</b>
        </tt>,... where <tt>
          <b>key1</b>
        </tt>,
          <tt>
          <b>key2,...</b>
        </tt> can be one of the following:<ul>
          <li>
            <tt>
              <b>style</b>
            </tt>: sets the style for each curve, see below for value.</li>
          <li>
            <tt>
              <b>leg</b>
            </tt>: sets the curves captions. If this key is given and
                <tt>
              <b>strf</b>
            </tt> is not given then <tt>
              <b>x</b>
            </tt> character
                of <tt>
              <b>strf</b>
            </tt> is supposed to be <tt>
              <b>1</b>
            </tt>. See
                below for value.</li>
          <li>
            <tt>
              <b>rect</b>
            </tt>: sets the bounds of the plot. If this key is given and
                neither <tt>
              <b>frameflag</b>
            </tt> nor <tt>
              <b>strf</b>
            </tt> is given
                then the <tt>
              <b>y</b>
            </tt> character of <tt>
              <b>strf</b>
            </tt> is
                supposed to be <tt>
              <b>7</b>
            </tt>. See below for value.</li>
          <li>
            <tt>
              <b>nax</b>
            </tt>: sets the grids definition. If this key is given and
                neither <tt>
              <b>axesflag</b>
            </tt> nor <tt>
              <b>strf</b>
            </tt> is given
                then the <tt>
              <b>z</b>
            </tt> character of <tt>
              <b>strf</b>
            </tt> is
                supposed to be <tt>
              <b>1</b>
            </tt>. See below for value.</li>
          <li>
            <tt>
              <b>logflag</b>
            </tt>: sets the scale (linear or logarithmic) along the axes.
                See below for value.</li>
          <li>
            <tt>
              <b>frameflag</b>
            </tt>: specifies how the frame of the plot is computed. The
                value is an integer ranging from 0 to 8. It corresponds to the
                <tt>
              <b>y</b>
            </tt> character of <tt>
              <b>strf</b>
            </tt>. See below.</li>
          <li>
            <tt>
              <b>axesflag</b>
            </tt>: specifies what kind of axes are drawn around the plot.
                The value is an integer ranging from 0 to 5. It corresponds to
                the <tt>
              <b>z</b>
            </tt> character of <tt>
              <b>strf</b>
            </tt>. See
                below.</li>
        </ul>
      </li>
      <li>
        <tt>
          <b>style</b>
        </tt>: is a real row vector of size nc. The style to use for curve
          <tt>
          <b>i</b>
        </tt> is defined by <tt>
          <b>style(i)</b>
        </tt>. The default
          style is <tt>
          <b>1:nc</b>
        </tt> (1 for the first curve, 2 for the second,
          etc.).<ul>
          <li>
            <tt>
              <b>-</b>
            </tt>if <tt>
              <b>style(i)</b>
            </tt> is negative or zero, the curve is
                plotted using the mark with id <tt>
              <b>abs(style(i))</b>
            </tt>; use
                <tt>
              <b>xset()</b>
            </tt> to set the mark id and xget('mark') to get
                the current mark id.</li>
          <li>
            <tt>
              <b>-</b>
            </tt>if <tt>
              <b>style(i)</b>
            </tt> is strictly positive, a plain
                line with color id <tt>
              <b>style(i)</b>
            </tt> or a dashed line with
                dash id <tt>
              <b>style(i)</b>
            </tt> is used; use <tt>
              <b>xset()</b>
            </tt>
                to see the color ids.</li>
          <li>
            <tt>
              <b>-</b>
            </tt>When only one curve is drawn, <tt>
              <b>style</b>
            </tt> can be
                the row vector of size 2 <tt>
              <b>[sty,pos]</b>
            </tt> where
                <tt>
              <b>sty</b>
            </tt> is used to specify the style and
                <tt>
              <b>pos</b>
            </tt> is an integer ranging from 1 to 6 which
                specifies a position to use for the caption. This can be
                useful when a user wants to draw multiple curves on a plot by
                calling the function <tt>
              <b>plot2d</b>
            </tt> several times and
                wants to give a caption for each curve.</li>
        </ul>
      </li>
      <li>
        <tt>
          <b>strf</b>
        </tt>: is a string of length 3 <tt>
          <b>"xyz"</b>
        </tt> (by default
          <tt>
          <b>strf= "081"</b>
        </tt>)<ul>
          <li>
            <tt>
              <b>x</b>
            </tt>: controls the display of captions.<ul>
              <li>
                <tt>
                  <b>x=0</b>
                </tt>: no caption.</li>
              <li>
                <tt>
                  <b>x=1</b>
                </tt>: captions are displayed. They are given by the
                      optional argument <tt>
                  <b>leg</b>
                </tt>.</li>
            </ul>
          </li>
          <li>
            <tt>
              <b>y</b>
            </tt>: controls the computation of the actual coordinate ranges
                from the minimal requested values. Actual ranges can be larger
                than minimal requirements.<ul>
              <li>
                <tt>
                  <b>y=0</b>
                </tt>: no computation, the plot use the previus (or
                      default) scale</li>
              <li>
                <tt>
                  <b>y=1</b>
                </tt>: from the rect arg</li>
              <li>
                <tt>
                  <b>y=2</b>
                </tt>: from the min/max of the x, y datas</li>
              <li>
                <tt>
                  <b>y=3</b>
                </tt>: built for an isometric scale from the rect
                      arg</li>
              <li>
                <tt>
                  <b>y=4</b>
                </tt>: built for an isometric plot from the min/max of
                      the x, y datas</li>
              <li>
                <tt>
                  <b>y=5</b>
                </tt>: enlarged for pretty axes from the rect arg</li>
              <li>
                <tt>
                  <b>y=6</b>
                </tt>: enlarged for pretty axes from the min/max of the
                      x, y datas</li>
              <li>
                <tt>
                  <b>y=7</b>
                </tt>: like y=1 but the previus plot(s) are redrawn to
                      use the new scale</li>
              <li>
                <tt>
                  <b>y=8</b>
                </tt>: like y=2 but the previus plot(s) are redrawn to
                      use the new scale</li>
            </ul>
          </li>
          <li>
            <tt>
              <b>z</b>
            </tt>: controls the display of information on the frame around
                the plot. If axes are requested, the number of tics can be
                specified by the <tt>
              <b>nax</b>
            </tt> optional argument.<ul>
              <li>
                <tt>
                  <b>z=0</b>
                </tt>: nothing is drawn around the plot.</li>
              <li>
                <tt>
                  <b>z=1</b>
                </tt>: axes are drawn, the y=axis is displayed on the
                      left.</li>
              <li>
                <tt>
                  <b>z=2</b>
                </tt>: the plot is surrounded by a box without tics.</li>
              <li>
                <tt>
                  <b>z=3</b>
                </tt>: axes are drawn, the y=axis is displayed on the
                      right.</li>
              <li>
                <tt>
                  <b>z=4</b>
                </tt>: axes are drawn centred in the middle of the frame
                      box.</li>
              <li>
                <tt>
                  <b>z=5</b>
                </tt>: axes are drawn so as to cross at point
                      <tt>
                  <b>(0,0)</b>
                </tt>. If point <tt>
                  <b>(0,0)</b>
                </tt> does not
                      lie inside the frame, axes will not appear on the
                      graph.</li>
            </ul>
          </li>
        </ul>
      </li>
      <li>
        <tt>
          <b>leg</b>
        </tt>: a string. It is used when the first character x of argument
          <tt>
          <b>strf</b>
        </tt> is 1. <tt>
          <b>leg</b>
        </tt> has the form
          <tt>
          <b>"leg1@leg2@...."</b>
        </tt> where <tt>
          <b>leg1</b>
        </tt>,
          <tt>
          <b>leg2</b>
        </tt>, etc. are respectively the captions of the first
          curve, of the second curve, etc. The default is <tt>
          <b>""</b>
        </tt>.</li>
      <li>
        <tt>
          <b>rect</b>
        </tt>: This argument is used when the second character y of argument
          <tt>
          <b>strf</b>
        </tt> is 1, 3 or 5. It is a row vector of size 4 and
          gives the dimension of the frame:
          <tt>
          <b>rect=[xmin,ymin,xmax,ymax]</b>
        </tt>.</li>
      <li>
        <tt>
          <b>nax</b>
        </tt>: This argument is used when the third character z of argument
          <tt>
          <b>strf</b>
        </tt> is 1. It is a row vector with four entries
          <tt>
          <b>[nx,Nx,ny,Ny]</b>
        </tt> where <tt>
          <b>nx</b>
        </tt> (<tt>
          <b>ny</b>
        </tt>)
          is the number of subgraduations on the x (y) axis and
          <tt>
          <b>Nx</b>
        </tt> (<tt>
          <b>Ny</b>
        </tt>) is the number of graduations on
          the x (y) axis.</li>
      <li>
        <tt>
          <b>logflag</b>
        </tt>: a string formed by to characters h (for horizontal axis) and v
          (for vertical axis) each of these characters can take the values "n"
          or "l". "l" stands for logarithmic graduation and "n" for normal
          graduation. For example "ll"stands for a log-log plot. Default value
          is "nn".</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>plot2d</b>
      </tt> plots a set of 2D curves. Piecewise linear plotting
    is used.</p>
    <p>By default, successive plots are superposed. To clear the previous
    plot, use <tt>
        <b>xbasc()</b>
      </tt>.</p>
    <p>See the meaning of the parameters above for a complete description.</p>
    <p>Enter the command <tt>
        <b>plot2d()</b>
      </tt> to see a demo.</p>
    <p>Other high level plot2d function exist:</p>
    <dl>
      <dd>
        <b>plot2d2</b>: same as <tt>
          <b>plot2d</b>
        </tt> but the curve is supposed to be
        piecewise constant.</dd>
      <dd>
        <b>plot2d3</b>: same as <tt>
          <b>plot2d</b>
        </tt> but the curve is plotted with
        vertical bars.</dd>
      <dd>
        <b>plot2d4</b>: same as <tt>
          <b>plot2d</b>
        </tt> but the curve is plotted with
        arrows.</dd>
    </dl>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

//simple plot 
x=[0:0.1:2*%pi]';
plot2d(sin(x))
xbasc()
plot2d(x,sin(x))
//multiple plot
xbasc()
plot2d(x,[sin(x) sin(2*x) sin(3*x)])
// multiple plot giving the dimensions of the frame 
// old syntax and new syntax
xbasc()
plot2d(x,[sin(x) sin(2*x) sin(3*x)],1:3,"011","",[0,0,6,0.5])
xbasc()
plot2d(x,[sin(x) sin(2*x) sin(3*x)],rect=[0,0,6,0.5])
//multiple plot with captions and given tics // old syntax and new syntax
xbasc()
plot2d(x,[sin(x) sin(2*x) sin(3*x)],..
  [1,2,3],"111","L1@L2@L3",[0,-2,2*%pi,2],[2,10,2,10]);
xbasc()
plot2d(x,[sin(x) sin(2*x) sin(3*x)],..
  [1,2,3],leg="L1@L2@L3",nax=[2,10,2,10],rect=[0,-2,2*%pi,2])
// isoview
xbasc()
plot2d(x,sin(x),1,"041")
// scale
xbasc()
plot2d(x,sin(x),1,"061")
// auto scaling with previous plots
xbasc()
plot2d(x,sin(x),1)
plot2d(x,2*sin(x),2) 
plot2d(2*x,cos(x),3)
// axis on the right 
xbasc()
plot2d(x,sin(x),1,"183","sin(x)")
// centered axis 
xbasc()
plot2d(x,sin(x),1,"184","sin(x)")
// axis centered at (0,0)
xbasc()
plot2d(x-4,sin(x),1,"185","sin(x)")
 
</pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="plot2d1.htm">
        <tt>
          <b>plot2d1</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="plot2d2.htm">
        <tt>
          <b>plot2d2</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="plot2d3.htm">
        <tt>
          <b>plot2d3</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="plot2d4.htm">
        <tt>
          <b>plot2d4</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="xbasc.htm">
        <tt>
          <b>xbasc</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="xset.htm">
        <tt>
          <b>xset</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
    <h3>
      <font color="blue">Author</font>
    </h3>
    <p>J.Ph.C.</p>
  </body>
</html>
